<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>忘记密码</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="lib/css/login.css" media="all">
    <link rel="stylesheet" href="lib/css/public.css" media="all">
    <script src="lib/login.js" charset="utf-8"></script>
    <script src="lib/lay-config.js?v=1.0.4" charset="utf-8"></script>

    <style>

        .layui-form-item .layui-input-company {
            width: auto;
            padding-right: 10px;
            line-height: 38px;
        }

        .layui-form-item .layui-input-company {
            width: auto;
            padding-right: 10px;
            line-height: 38px;
        }

    </style>

    <script>
        $(function () {
            $("#pupdate").click(function () {
                let user = {
                    username: $("#username").val(),
                    password: $("n").val(),
                };
                let params = {
                    user: JSON.stringify(user)
                };
                $.post("http://127.0.0.1:8080/user/update", params, function (result) {
                    if (result.status === 200) {
                        window.location.href = "user_home.html"
                    }
                })
            });
        })

        $(function () {
            $("#password-check").bootstrapValidator(
                {
                    message: "数据格式不正确,请检查后再提交",
                    feedbackIcons: {
                        valid: 'glyphicon glyphicon-ok',
                        invalid: 'glyphicon glyphicon-remove',
                        validating: 'glyphicon glyphicon-refresh'
                    },

                    fields: {
                        username: {
                            message: '用户必须是字母开头,长度不能小于8位',
                            validators: {
                                notEmpty: {
                                    message: "用户名不能为空"
                                },
                                regexp: {
                                    regexp: "^[a-zA-Z][a-zA-Z0-9]{7,16}$",
                                }
                            }
                        },
                        password: {
                            message: "密码格式不正确",
                            validators: {
                                notEmpty: {
                                    message: "密码不能为空"
                                },
                                stringLength: {
                                    min: 8,
                                    max: 18,
                                    message: "密码长度不能小于8位"
                                }
                            }
                        }
                    }
                })
        })
    </script>

</head>
<body>
<div class="layuimini-container" id="password-check">
    <div class="layuimini-main">

        <div class="layui-form layuimini-form">
            <div class="layui-form-item">
                <label class="layui-form-label required">旧的密码</label>
                <div class="layui-input-block">

                    <input id="old_password" type="password" name="old_password" lay-verify="required" lay-reqtext="旧的密码不能为空"
                           placeholder="请输入旧的密码" value="" class="layui-input">

                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label required">新的密码</label>
                <div class="layui-input-block">
                    <input id="new_password" type="password" name="new_password" lay-verify="required" lay-reqtext="密码不能为空"
                           placeholder="请输入新的密码" value="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">确认密码</label>
                <div class="layui-input-block">

                    <input id="again_password" type="password" name="again_password" lay-verify="required" lay-reqtext="密码不能为空"
                           placeholder="请输入确认密码" value="" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" id="pupdate" >确认保存</button>
                </div>
            </div>
        </div>
    </div>
</div>


</body>
</html>